package com.zhijiaoyun.dao;

import com.zhijiaoyun.dao.core.IBaseDao;
import com.zhijiaoyun.model.CourseCategory;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author shisfish
 * @date 2017/6/6
 */
public interface ICourseCategoryDao extends IBaseDao<CourseCategory> {

    /**
     * get by name
     *
     * @param name
     * @return
     */
    CourseCategory getCourseCategoryByName(String name);

    /**
     * get by name not id
     *
     * @param name
     * @param categoryId
     * @return
     */
    CourseCategory getCourseCategoryByNameNotCategoryId(@Param("name") String name,
                                                        @Param("categoryId") long categoryId);

    /**
     * list all
     *
     * @return
     */
    List<CourseCategory> listAll();

    /**
     * list by parentId
     *
     * @param parentId
     * @return
     */
    List<CourseCategory> listByParentId(long parentId);

    /**
     * list ids by parentId
     *
     * @param parentId
     * @return
     */
    List<Long> selectIdsByParentId(Long parentId);

    /**
     * get name by id
     *
     * @param categoryId
     * @return
     */
    String selectNameByCategoryId(Long categoryId);

    /**
     * get by name and parentId
     *
     * @param name
     * @param parentId
     * @return
     */
    CourseCategory selectByNameParentId(@Param("name") String name, @Param("parentId") Long parentId);

    /**
     * get by name and parentId not id
     *
     * @param name
     * @param parentId
     * @param categoryId
     * @return
     */
    CourseCategory selectByNameParentIdNotCategoryId(@Param("name") String name, @Param("parentId") Long parentId,
                                                     @Param("categoryId") Long categoryId);

    /**
     * delete by parentId
     *
     * @param parentId
     */
    void deleteByParentId(Long parentId);

    /**
     * list special ids by parentId and tag<isHigerEdu>
     *
     * @param parentId
     * @param isHigerEdu
     * @return
     */
    List<Long> selectSpecialIdsByParentId(@Param("parentId") Long parentId, @Param("isHigerEdu") boolean isHigerEdu);

    /**
     * list special ids by parentId and type
     *
     * @param parentId
     * @param type
     * @return
     */
    List<Long> selectSpecialIdsByParentIdType(@Param("parentId") Long parentId, @Param("type") int type);
}